<template>
  <div>
    <div>
      <el-button type="primary" icon="el-icon-search" @click="onShareWinInfo()">搜索</el-button>
      <el-input style="width: 30%"
                placeholder="请输入内容(UID)"
                v-model="inputDesc">
        <i slot="prefix" class="el-input__icon el-icon-search"></i>
      </el-input>
      <el-divider><i class="el-icon-zoom-in"></i></el-divider>
    </div>
    <el-table
      :data="tableData"
      border
      style="width: 100%"
      max-height="950">
      <el-table-column
        prop="uid"
        label="UID">
      </el-table-column>
      <el-table-column
        prop="userName"
        label="用户名">
      </el-table-column>
      <el-table-column
        prop="introduce"
        label="奖品">
      </el-table-column>
      <el-table-column
        prop="gold"
        label="金额">
      </el-table-column>
      <el-table-column
        prop="count"
        label="期数">
      </el-table-column>
    </el-table>
    <!--分页-->
    <el-pagination
      v-show="allSize > 30"
      style="margin-top: 20px"
      background
      layout="prev, pager, next"
      @current-change="handleCurrentChange"
      :current-page.sync="currentPage"
      :total="allSize"
      :page-size="pageSize">
    </el-pagination>
  </div>

</template>

<script>
  const pageSizeConst = 30;
  import axios from 'axios'
  export default {
    created() {
      this.onShareWinInfo()
    },
    methods: {
      handleCurrentChange: function(currentPage){
        this.currentPage = currentPage;
        this.onShareWinInfo()
      },
      onShareWinInfo(){
        axios.get("/sharewin", {
          params: {
            pageSize: pageSizeConst,
            currentPage: this.currentPage,
            day:this.inputDesc
          }
        }).then(resp => {
          if (resp.data.result) {
            this.tableData = resp.data.msg.data
            this.allSize = resp.data.msg.count
          }
        })
      },
    },
    data() {
      return {
        tableData: [],
        inputDesc: '0',
        allSize: 0,
        currentPage: 1,
        pageSize: pageSizeConst,
      }
    }
  }
</script>

<style scoped>

</style>
